﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PokerClient.Connection.CommandHandlers;
using PokerClient.VisualDisp;

namespace PokerClient.Commands.CommandHandlers
{
	class HandHandler : absHandler
	{

		Table myTable;
		Client myClient;
		String message;
		public HandHandler(Client myClient, Table myTable)
		{
			this.myTable = myTable;
			this.myClient = myClient;
		}
		public override void assignCommand(string commands)
		{
			this.commands = commands.Split(' ',',');
		}

		public override string work()
		{
			try
			{
				myTable.updatePlayerCards(commands[1],commands[2]);
				return  message = "Success!";
			}
			catch (System.Exception ex)
			{
				return message = ex.Message;
			}
			

		}

		public override void analyze()
		{
			switch(message)
			{
				case "Success!":
					this.myTable.updateStatus(message);
					break;
				default:
					this.myTable.updateStatus(message);
					break;
			}
		}
	}
}
